cmake_policy(SET CMP0048 NEW)

project(cuda-play LANGUAGES CUDA CXX VERSION 0.0.1) 

cmake_minimum_required(VERSION 3.12)

enable_language(CUDA)

include(CheckLanguage)
check_language(CUDA)


set(CMAKE_CXX_STANDARD 17)
# cmake_policy(SET CMP0079 NEW)
cmake_policy(SET CMP0048 NEW)
set(CMAKE_CUDA_ARCHITECTURES 60)

if(NOT DEFINED CMAKE_CUDA_STANDARD)
    set(CMAKE_CUDA_STANDARD 17)
    set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()

find_package(Threads REQUIRED)

set(CMAKE_EXPORT_COMPILE_COMMANDS on)

if (DEFINED ENV{HOMEBREW_NO_AUTO_UPDATE})
    message("using homebrew")
    find_package(gflags REQUIRED)
    find_package(glog REQUIRED)
    find_package(GTest REQUIRED)
    add_library(gflags::gflags ALIAS gflags)
else()
    message("not using homebrew")
    add_subdirectory(third_party/gflags)
    add_subdirectory(third_party/glog)
    add_subdirectory(third_party/googletest)
    add_library(GTest::gtest_main ALIAS gtest_main)
endif()



add_library(common_deps INTERFACE)

target_include_directories(common_deps INTERFACE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(common_deps INTERFACE gflags::gflags glog::glog GTest::gtest_main)
set(inc ${CMAKE_SOURCE_DIR}/include/cuda-play)

add_subdirectory(src/cuda-play)

add_library(cuda_play_lib INTERFACE)

target_link_libraries(cuda_play_lib INTERFACE utils)

add_subdirectory(perf)